<?php
include 'config.php';
if (!isset($_COOKIE['hid'])) {
    header('Location:index');
}
$hid = $_COOKIE['hid'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" charset="urf-8" />        
        <link href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/salusme/include/css/fal_style.css" rel="stylesheet" type="text/css" />
        <script src="<?php echo 'http://' . $_SERVER['HTTP_HOST'] ?>/salusme/include/js/flash.js" type="text/javascript"></script>
        <script type="text/javascript">$(document).ready(function(){document.getElementById('maildata').value=$('#mainContent').html();});</script>
        <script type="text/javascript">function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');}</script>
        <script type="text/javascript" src="element.js?cb=googleTranslateElementInit"></script>
        <script type="text/javascript">

            function PrintElem(elem){Popup($(elem).html());}
            function Popup(data){
                var mywindow = window.open('', 'Print', 'height=700,width=600');                        
                mywindow.document.write(data);
                mywindow.document.close();
                mywindow.print();                
                return true;
            }
        </script>

        <link type="text/css" href="<?php echo 'http://' . $_SERVER['HTTP_HOST'] ?>/salusbaby/include/css/ui-lightness/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
        <script type="text/javascript" src="<?php echo 'http://' . $_SERVER['HTTP_HOST'] ?>/salusbaby/include/js/jquery-1.7.2.js"></script>
        <script type="text/javascript" src="<?php echo 'http://' . $_SERVER['HTTP_HOST'] ?>/salusbaby/include/js/jquery-ui-1.8.21.custom.min.js"></script>
        <script type="text/javascript">
            $(function(){

                // Accordion
                $("#accordion").accordion({ header: "h3",collapsible:true, autoHeight:false,navigation:true, active:false  });

                // Tabs
                $('#tabs').tabs();

                // Dialog
                $('#dialog').dialog({
                    autoOpen: false,
                    width: 600,
                    buttons: {
                        "Ok": function() {
                            $(this).dialog("close");
                        },
                        "Cancel": function() {
                            $(this).dialog("close");
                        }
                    }
                });

                // Dialog Link
                $('#dialog_link').click(function(){
                    $('#dialog').dialog('open');
                    return false;
                });

                // Datepicker
                $('#datepicker').datepicker({});

                // Slider
                $('#slider').slider({
                    range: true,
                    values: [17, 67]
                });

                // Progressbar
                $("#progressbar").progressbar({
                    value: 20
                });

                //hover states on the static widgets
                $('#dialog_link, ul#icons li').hover(
                function() { $(this).addClass('ui-state-hover'); },
                function() { $(this).removeClass('ui-state-hover'); }
            );

            });
        </script>

        <style>
            .demoHeaders { margin-top: 2em; }
            #dialog_link,#dialog_link1, #dialog_link2  {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
            #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
            ul#icons {margin: 0; padding: 0;}
            ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
            ul#icons span.ui-icon {float: left; margin: 0 4px;}
            .bb th, .bb td{
                border-bottom:  1px #000000 dotted !important ;
                text-align: center;
            }
        </style>
        <script>
            $(function(){
                $('#dlg').click(function(){$('#dialog').dialog('open');return false;});
                $('#dlg1').click(function(){$('#dialog1').dialog('open');return false;});
                $("#dialog").dialog({autoOpen : false,modal : true,width : 'auto',height: 'auto',resizable : false,buttons: {"Don't Save": function() {$(this).dialog("close");}}});
                $("#dialog1").dialog({autoOpen : false,modal : true,width : 'auto',height: 'auto',resizable : false,buttons: {"Don't Save": function() {$(this).dialog("close");}}});
            });
        </script>
    </head>
    <?php
    $gh = mysql_fetch_array(mysql_query("select name from salus_hospital_list where hospital_id = $hid ")) or die(mysql_error());
    $hospital_name = $gh['name'];
    ?>
    <title>Welcome, <?= $hospital_name ?></title>

    <body>
        <div id="wrapper">
            <div id="header_small"></div>
            <div class="float_left profile_left margin_10">
                <div>
                    English
                    <div id="google_translate_element"></div>
                </div><br/><br/><br/><br/><br/>   
                <a href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/salushospital/logout.php"><div class="main_menu">LOGOUT</div></a>
                <div class="clear"></div>
            </div>        
            <div class="salus_bank_reg float_left">
                <h2>Welcome,  <?= $hospital_name ?>...!!!</h2><div class="down_arrow"></div>
                <div class="clear"></div>                
                <div class="float_left top_menu "><a href="welcome">HOLDING TANK</a></div>
                <div class="float_left top_menu "><a href="#" id="dlg">SEND FILE</a></div>
                <div class="float_left top_menu "><a href="#" id="dlg1">MODIFY DETAILS</a></div>
                <div class="clear"></div>
                <hr>
                    <div id="mainContent">   
                        <?php if ($_GET['e'] == 'u'): ?>
                            <div style="color: red; text-align: center; ">
                                <b>Error : </b> User Name not founded.
                            </div>
                        <?php endif; ?>
                        <?php if ($_GET['e'] == 'e'): ?>
                            <div style="color: red; text-align: center; ">
                                <b>Error : </b> Error in uploading file. Try Again !
                            </div>
                        <?php endif; ?>
                        <?php if ($_GET['e'] == 's'): ?>
                            <div style="color: green; text-align: center; ">
                                <b>Congratulation : </b> Your file successfully uploaded.
                            </div>
                        <?php endif; ?>
                        <table style=" width: 620px; " class="bb">
                            <tr >
                                <th style="width: 10px;">Sr</th>
                                <th style="width: 230px;">File Name</th>
                                <th style="width: 165px;">User Account</th>                                                        
                                <th style="width: 70px;">Status</th>
                            </tr>
                            <?php
                            $i = 1;
                            $f = mysql_query("select * from hospital_data where sender_id= $hid ") or die(mysql_error());
                            while ($row = mysql_fetch_array($f)) {
                                ?>
                                <tr>
                                    <td><?= $i ?></td>
                                    <td><?= $row['title'] ?></td>
                                    <td><?php
                            $u = mysql_fetch_array(mysql_query("select user_name from fa_user where id='" . $row['receiver_id'] . "' ")) or die(mysql_error());
                            echo $u['user_name'];
                                ?></td>
                                    <td><?php
                                    if ($row['flag'] == 0) {
                                        echo '<font color=grey>Waiting</font>';
                                    }
                                    if ($row['flag'] == 1) {
                                        echo '<font color=green>Accepted</font>';
                                    }
                                    if ($row['flag'] == 2) {
                                        echo '<font color=red>Cancelled</font>';
                                    }
                                ?></td>
                                </tr>
                                <?php
                                $i++;
                            }
                            ?>                            
                        </table>                        
                    </div>

                    <div id="dialog" title="Send New File" >
                        <p>
                            <form id="uploader" name="uploader" method="post" action="upload_file.php" enctype="multipart/form-data" >
                                <table>
                                    <tr>
                                        <td>File Name :</td>
                                        <td><input type="text" placeholder="File Title" name="title" required /></td>
                                    </tr>                                                
                                    <tr>
                                        <td>File :</td>
                                        <td><input type="file"  name="uploadedfile" required /></td>
                                    </tr>                                                
                                    <tr>
                                        <td>Send to :</td>
                                        <td><input type="text" placeholder="User Name" name="user_name" required /></td>
                                    </tr>                                                
                                    <tr>
                                        <td><input type="hidden" name="MAX_FILE_SIZE" value="100000000000" /></td>
                                        <td><input type="submit" value="Send File" /></td>
                                    </tr>
                                </table>

                            </form>
                        </p>
                    </div>
                    <div id="dialog1" title="Modify Hospital Details">
                        <form method="post" action="updt.php" >
                            <table>
                                <?php
                                $query1 = mysql_query("select * from salus_hospital_list where hospital_id = $hid") or die(mysql_error());
                                while ($row1 = mysql_fetch_array($query1)) {
                                    ?>
                                    <tr>
                                        <td>Hospital Name :</td>
                                        <td><input type="text" placeholder="Hospital Name" name="name" value="<?= $row1['name'] ?>" required /></td>
                                    </tr>
                                    <tr>
                                        <td>Hospital Person :</td>
                                        <td><input type="text" placeholder="Person name" name="person" value="<?= $row1['person'] ?>" required /></td>
                                    </tr>
                                    <tr>
                                        <td>Email:</td>
                                        <td><input type="text" placeholder="Email" name="email" value="<?= $row1['email'] ?>" required /></td>
                                    </tr>
                                    <tr>
                                        <td>Phone :</td>
                                        <td><input type="text" placeholder="Phone number" name="phone" value="<?= $row1['phone'] ?>" required /></td>
                                    </tr>
                                    <tr>
                                        <td>Country :</td>
                                        <td>
                                            <select name="country" style="width: 175px;" required >
                                                <?php
                                                $n1 = mysql_query("select * from fa_country");
                                                while ($nation1 = mysql_fetch_array($n1)) {
                                                    ?>
                                                    <option <?php if ($row1['country'] == $nation1['id']) echo 'selected'; ?>  value="<?= $nation1['id'] ?>" ><?= $nation1['name'] ?></option>  
                                                <?php } ?>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><input type="hidden" name="sr" value="<?= $row1['sr'] ?>" /></td>
                                        <td><input type="submit" value="Update Info" /></td>
                                    </tr>
                                <?php }
                                ?>
                            </table>
                        </form>
                    </div>


            </div><!-- wrapper over    -->

            <div class="right_menu">
                <!--                    <div class="float_left">-->
                <div>
                    <div class="right_logo">
                        <a href="http://www.ndroid360.com/salus/index.php/salus_bank/add_product/2"><div class="salus_baby_logo logo"></div></a>
                    </div>
                    <div class="right_logo">
                        <a href="http://www.ndroid360.com/salus/index.php/salus_bank/add_product/3"><div class="salus_pets_logo logo"></div></a>
                    </div>
                    <div class="right_logo">
                        <a href="http://www.ndroid360.com/salus/index.php/salus_bank/add_product/4"><div class="salus_sport_logo logo"></div></a>
                    </div>
                </div>

                <div>
                    <div style="border-bottom: 2px solid #898989">
                        <div class="news_title">MEDICINE:</div>
                        <div  class="news_desc">Discovered two genes involved in high blood pressure</div>
                    </div>
                    <div style="border-bottom: 2px solid #898989">
                        <div class="news_title">BRAIN:</div>
                        <div  class="news_desc">A smoker of ten continuous after diagnosis of cancer oncology</div>
                    </div>
                </div>
                <div>
                    <div class="news_title" >Calendar</div>        
                </div>
                <div>

                    <div id="datepicker" style="margin: 5px 0px 0px 1px; font-size: 8.7px; "></div>
                    <div id="dialog-a"></div>
                </div>

                <!--                    </div>-->
            </div><div class="clear"></div>

    </body>
</html>